//
//  BlockControllerSwift.swift
//  LittleSummary
//
//  Created by 郝旭珊 on 2018/3/17.
//  Copyright © 2018年 郝旭珊. All rights reserved.
//

import UIKit

class BlockControllerSwift: UIViewController {

    var passSearchText: ((_ text:String) -> ())?
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        if self.passSearchText != nil{
            self.passSearchText!("text")
        }
    }

    override func viewDidLoad() {
        super.viewDidLoad()

    }



    //1.定义闭包函数
    let c = 3
    let sum = {(a:NSInteger, b:NSInteger) -> NSInteger in
        return a+b
    }

    //2.作为函数参数
    func loadData(callback:(_ isSuccess:Bool) -> Void){
        callback(true)
    }

    func loadData2(callback:(_ isSuccess:Bool) -> String){
      let str = callback(true)
    }




}
